# Copyright 2007 pyPayPal Dev Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 only
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import private

# Classes Using Direct Payment Method
class Direct_Payment_Sale(private._DirectPayment):
    """ 
    Final Sale action with the PayPal DirectPayment method.
    This class will complete a full transaction with said customer.
    Upon successfully passing this class to the NVP interface, the total amount will be credited to your Paypal account
    minus fees.
    """
    def __init__(self, credit_card = None, billing_address = None, ip = None , shipping_address=None, subtotal = None, cart=None):
        private._DirectPayment.__init__(self, credit_card, billing_address, ip, shipping_address, subtotal, cart)
        self._action = 'Sale'

class Direct_Payment_Authorization(private._DirectPayment):
    """ 
    Authorization action using the PayPal DirectPayment method.
    This class will only authorize a total amount on a customers card.  You must use the capture actions to complete the transaction.
    This is useful if you do not want to receive payment until the item has been shipped for example. 
    Pass this to the interface class when ready 
    """
    def __init__(self, credit_card = None, billing_address = None, ip = None , shipping_address=None, subtotal = None, cart=None):
        private._DirectPayment.__init__(self, credit_card, billing_address, ip, shipping_address, subtotal, cart)
        self._action = 'Authorization'

# Classes using the Express Checkout Method
class Express_Checkout_Sale(private._Express_Checkout):
    """
    Final Sale action using the PayPal Express Checkout.
    Express Checkout is useful if the user already has a paypal account.  They can simply login to paypal instead of having to enter
    in all of thier credentials like you would have to do using a direct payment method.
    This class will complete a full transaction with said customer.
    Upon successfully passing this class to the NVP interface, the total amount will be credited to your Paypal account
    minus fees.
    """
    def __init__(self, return_url = None, cancel_url = None, require_confirmed_address_flag = 0, no_shipping_flag = 0):
        private._Express_Checkout.__init__(self, return_url, cancel_url, require_confirmed_address_flag, no_shipping_flag)
        self._action = "Sale"
                    
class Express_Checkout_Authorization(private._Express_Checkout):
    """ 
    Authorization action using the PayPal Express Checkout.
    Express Checkout is useful if the user already has a paypal account.  They can simply login to paypal instead of having to enter
    in all of thier credentials like you would have to do using a direct payment method.
    This class will only authorize a total amount on a customers card.  You must use the capture actions to complete the transaction.
    This is useful if you do not want to receive payment until the item has been shipped for example. 
    Pass this to the interface class when ready 
    """
    def __init__(self, return_url = None, cancel_url = None, require_confirmed_address_flag = 0, no_shipping_flag = 0):
        private._Express_Checkout.__init__(self, return_url, cancel_url, require_confirmed_address_flag, no_shipping_flag)
        self._action = "Authorization"
        
#Now for the Backroom Actions
class Complete_Capture(private._Capture):
    """ 
    This class is used for grabbing funds from a previous Authorization.  This class will grab the funds all at once,
    and will complete the transaction if successful.
    """
    def __init__(self, transaction_id = None, capture_amount = None, invoice_number = None, note = None):
        private._Capture.__init__(self, transaction_id, capture_amount, capture_amount, invoice_number, note)
        
class Partial_Capture(private._Capture):
    """
    This class is used for grabbing funds from a previous Authorization.  Unlike Complete_capture, this
    class is designed to only grab a portion of the previously authorized funds.  In order to do this, this class
    must know the outstanding amount, the amount that is left to be captured.
    For example, if an authorization came through for $100.00, the outstanding amount would be $100.00.  Then 
    if you set the capture amount to $20.00, and sent it off to paypal, the new outstanding amount would be $80.00.
    Once you use the partial capture class, you must use it until the full amount has been captured.
    """
    def __init__(self, transaction_id = None, outstanding_amount = None, capture_amount = None, invoice_number = None, note = None):
        private._Capture.__init__(self, transaction_id, outstanding_amount, capture_amount, invoice_number, note)